home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 3863 / 3863.xpi / components / nsiMacros.js < prev    next >
Text File  |  2010-01-25  |  24KB  |  5 lines

  1.  
  2. /*
  3. (c) Copyright 2008 iOpus Software GmbH - http://www.iopus.com
  4. */
  5. const Cc=Components.classes;const Ci=Components.interfaces;const jsdIDebuggerService=Ci.jsdIDebuggerService;const jsdIExecutionHook=Ci.jsdIExecutionHook;const jsdIErrorHook=Ci.jsdIErrorHook;const jsdICallHook=Ci.jsdICallHook;const jsdIValue=Ci.jsdIValue;const jsdIProperty=Ci.jsdIProperty;const jsdIScript=Ci.jsdIScript;const jsdIStackFrame=Ci.jsdIStackFrame;const jsdIContext=Ci.jsdIContext;const nsISupports=Ci.nsISupports;const nsIContentPolicy=Ci.nsIContentPolicy;const nsIChannelEventSink=Ci.nsIChannelEventSink;const nsIObserver=Ci.nsIObserver;const nsIObserverService=Ci.nsIObserverService;const nsITimer=Ci.nsITimer;const nsICommandLine=Ci.nsICommandLine;const nsIWindowWatcher=Ci.nsIWindowWatcher;const nsICommandLineHandler=Ci.nsICommandLineHandler;const NS_BINDING_ABORTED=Components.results.NS_BINDING_ABORTED;const SubLoader=Cc["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Ci.mozIJSSubScriptLoader);const IFX_CLASS_ID=Components.ID("{c9d532d1-8c48-4cd7-9a67-b071bbae18fc}");const IFX_CLASS_NAME="iMacros Player";const IFX_CONTRACT_ID="@iopus.com/jsplayer;1";const TYPE_TOPLEVEL_START=jsdICallHook.TYPE_TOPLEVEL_START;const TYPE_TOPLEVEL_END=jsdICallHook.TYPE_TOPLEVEL_END;const TYPE_BREAKPOINT=jsdIExecutionHook.TYPE_BREAKPOINT;const TYPE_DEBUG_REQUESTED=jsdIExecutionHook.TYPE_DEBUG_REQUESTED;const RETURN_HOOK_ERROR=jsdIExecutionHook.RETURN_HOOK_ERROR;const RETURN_CONTINUE=jsdIExecutionHook.RETURN_CONTINUE;const RETURN_ABORT=jsdIExecutionHook.RETURN_ABORT;const RETURN_RET_WITH_VAL=jsdIExecutionHook.RETURN_RET_WITH_VAL;const RETURN_THROW_WITH_VAL=jsdIExecutionHook.RETURN_THROW_WITH_VAL;const PCMAP_SOURCETEXT=jsdIScript.PCMAP_SOURCETEXT;function __dump_frame(frame){__loginf("frame.executionContext.tag="+frame.executionContext.tag+"\n"+"frame.functionName="+frame.functionName+"\n"+"frame.pc="+frame.pc+"\n"+"frame.line="+frame.line+"\n"+"frame.script.fileName="+frame.script.fileName+"\n"+"frame.script.baseLineNumber="+frame.script.baseLineNumber+"\n"+"frame.script.lineExtent="+frame.script.lineExtent+"\n"+"frame.script.tag="+frame.script.tag+"\n"+"frame.script.functionName="+frame.script.functionName+"\n"+"frame.script.functionSource:\n"+frame.script.functionSource);};function iMacrosPlayer(){this.wrappedJSObject=this;this.oldHooks=new Object();if(!this.jsds.isOn){this.jsds.on();}this.oldHooks.errorHook=this.jsds.errorHook;this.jsds.errorHook=this;this.oldHooks.debugHook=this.jsds.debugHook;this.jsds.debugHook=this;if(typeof(__loginf)=="undefined")SubLoader.loadSubScript("chrome://imacros/content/utils.js");};iMacrosPlayer.prototype={init:function(funcName){this.followFunc=funcName;this.stopIsPending=false;this.pauseIsPending=false;this.delayEnabled=false;this.playingDelay=200;},followModeOn:function(){this.oldHooks.topLevelHook=this.jsds.topLevelHook;this.jsds.topLevelHook=this;},followModeOff:function(){this.jsds.topLevelHook=this.oldHooks.topLevelHook;this.oldHooks.topLevelHook=null;},setDelay:function(enable,delay){this.delayEnabled=enable;if(typeof(delay)!="undefined"&& !isNaN(__int(delay)))this.playingDelay=__int(delay);},pause:function(){this.pauseIsPending=true;},unPause:function(){if(this.paused){this.paused=false;this.nloop.exit("player-pause");}},isPaused:function(){return this.paused;},stop:function(){this.stopIsPending=true;},onCall:function(frame,type){if(type==TYPE_TOPLEVEL_START){if(frame.functionName==this.followFunc&& !frame.script.functionName){this.oldHooks.breakpointHook=this.jsds.breakpointHook;this.jsds.breakpointHook=this;var baseline=frame.script.baseLineNumber;var endline=baseline+frame.script.lineExtent;for(var i=baseline;i<endline;i++){if(frame.script.isLineExecutable(i,PCMAP_SOURCETEXT)){var pc=frame.script.lineToPc(i,PCMAP_SOURCETEXT);frame.script.setBreakpoint(pc);}}}}else if(type==TYPE_TOPLEVEL_END){if(frame.functionName==this.followFunc&& !frame.script.functionName){frame.script.clearAllBreakpoints();this.jsds.breakpointHook=this.oldHooks.breakpointHook;this.oldHooks.breakpointHook=null;}}if(this.oldHooks.topLevelHook)this.oldHooks.topLevelHook.onCall(frame,type);},onExecute:function(frame,type,val){var line=frame.line-frame.script.baseLineNumber+1;if(type==TYPE_BREAKPOINT){if(this.pauseIsPending){this.nloop.enter("player-pause",this);}else if(this.stopIsPending){this.stopIsPending=false;val.value=this.jsds.wrapValue("JSStop");return RETURN_THROW_WITH_VAL;}if(this.delayEnabled){this.osvc.notifyObservers(null,"js-step-start",line);this.nloop.enter("js-step",this);this.osvc.notifyObservers(null,"js-step-end",line);}if(this.oldHooks.breakpointHook)return this.oldHooks.breakpointHook.onExecute(frame,type,val);}else if(type==TYPE_DEBUG_REQUESTED){this.onDebugRequested(frame,type,val);}return RETURN_CONTINUE;},onDebugRequested:function(frame,type,val){if(!this.errorInfo)return;var jsctx=frame.executionContext;var wnd=jsctx.globalObject.getWrappedValue();var msg="An error occured '"+this.errorInfo.message+"'"+" in "+this.errorInfo.sourceName+" at line "+this.errorInfo.lineNumber;this.osvc.notifyObservers(wnd,"imacros-error-occured",msg);delete this.errorInfo;},onError:function(msg,fname,line,pos,flags,enum,exc){var retval=this.oldHooks.errorHook?this.oldHooks.errorHook.onError(msg,fname,line,pos,flags,enum,exc):true;if(flags&jsdIErrorHook.REPORT_WARNING)return retval;if(!/^(?:https?|file):\/\//.test(fname))return retval;this.errorInfo={message:msg,sourceName:fname,lineNumber:line};return false;},onEnterLoop:function(){if(this.pauseIsPending){this.pauseIsPending=false;this.paused=true;}else if(this.delayEnabled){this.timer=Cc["@mozilla.org/timer;1"].createInstance(nsITimer);this.timer.initWithCallback(this,this.playingDelay,nsITimer.TYPE_ONE_SHOT);}},notify:function(timer){this.nloop.exit("js-step");this.timer=null;},get jsds(){var jsd=Cc["@mozilla.org/js/jsd/debugger-service;1"];return jsd.getService(jsdIDebuggerService);},get osvc(){var os=Cc["@mozilla.org/observer-service;1"];return os.getService(nsIObserverService);},get nloop(){var l=Cc["@iopus.com/nestedloop;1"].getService(nsISupports);return l=l.wrappedJSObject;},get jsdelay(){return this._jsdelay;},set jsdelay(delay){this._jsdelay=delay;},QueryInterface:function(iid){if(iid.equals(nsISupports))return this;throw Components.results.NS_ERROR_NO_INTERFACE;}};const LOOP_CLASS_ID=Components.ID("{9eee33b8-7755-4af0-b875-39231a9ba9c6}");const LOOP_CLASS_NAME="iMacros NestedLoop";const LOOP_CONTRACT_ID="@iopus.com/nestedloop;1";function NestedLoop(){this.wrappedJSObject=this;this.stack=new Array();this.handlers=new Object();this.depth=0;if(!this.jsds.isOn){this.jsds.on();}if(typeof(__loginf)=="undefined")SubLoader.loadSubScript("chrome://imacros/content/utils.js");};NestedLoop.prototype={enter:function(tag,onEnterHandler){try{this.stack.push(tag);this.handlers[tag]=onEnterHandler;this.jsds.enterNestedEventLoop(this);}catch(e){Components.utils.reportError(e);}},exit:function(tag){try{var cur=this.stack.pop();if(cur!=tag){this.stack.push(cur);throw "Bad tag: '"+tag+"' for NestedLoop.exit()";}this.handlers[tag]=null;this.jsds.exitNestedEventLoop();}catch(e){Components.utils.reportError(e);}},exitAll:function(){try{while(this.stack.length){this.exit(this.stack.pop());}for(var handler in this.handlers)handler=null;this.stack=new Array();this.handlers=new Object();}catch(e){Components.utils.reportError(e);}},onNest:function(){try{var tag=this.stack[this.stack.length-1];var handler=this.handlers[tag];if(handler)handler.onEnterLoop(tag);}catch(e){Components.utils.reportError(e);}},get jsds(){var jsd=Cc["@mozilla.org/js/jsd/debugger-service;1"];return jsd.getService(jsdIDebuggerService);},QueryInterface:function(iid){if(iid.equals(nsISupports))return this;throw Components.results.NS_ERROR_NO_INTERFACE;}};const WATCHER_CLASS_ID=Components.ID("{e4a28173-828d-486e-937c-4c8e4d7a8511}");const WATCHER_CLASS_NAME="iMacros Request Watcher";const WATCHER_CONTRACT_ID="@iopus.com/requestwatcher;1";function RequestWatcher(){this.wrappedJSObject=this;this.isListLoaded=false;this.whiteList=null;this.filterImages=false;this.runPattern=new RegExp('^(?:http://run\\.imacros\\.net|'+'imacros://run)'+'/\\?(code|m)=(.*)');const im_strre="(?:[^\"\\\\]|\\\\[0btnvfr\"\'\\\\])+";this.jsPattern=new RegExp('^javascript:\\(function\\(\\) '+'\\{var (m64|m) = "('+im_strre+')"'+', n = "('+im_strre+')";');if(typeof(__loginf)=="undefined")SubLoader.loadSubScript("chrome://imacros/content/utils.js");};RequestWatcher.prototype={enableImageFilter:function(enable){if(typeof enable=="undefined"||enable)this.filterImages=true;else if(!enable)this.filterImages=false;},querySite:function(site){if(!this.isListLoaded)this.loadList();return site in this.whiteList;},addSite:function(site){if(!this.isListLoaded)this.loadList();this.whiteList[site]=true;this.saveList();},blockSite:function(site){if(!this.isListLoaded)this.loadList();this.whiteList[site]=false;this.saveList();},removeSite:function(site){if(!this.isListLoaded)this.loadList();if(site in this.whiteList)delete this.whiteList[site];this.saveList();},enumerateSites:function(){if(!this.isListLoaded)this.loadList();return this.whiteList;},loadList:function(){try{var list=im_Pref.getCharPref("white-list");this.whiteList=list&&/{.*}/.test(list)?eval(list):{};}catch(e){this.whiteList={};this.saveList();}finally{this.isListLoaded=true;}},saveList:function(){im_Pref.setCharPref("white-list",this.whiteList.toSource());},unescapeLine:function(line){var escape_values={"0":"\u0000","b":"\u0008","t":"\u0009","n":"\u000A","v":"\u000B","f":"\u000C","r":"\u000D","\"":"\u0022","\'":"\u0027","\\\\":"\u005C"};for(var x in escape_values)line=line.replace(new RegExp("\\\\"+x,"g"),escape_values[x]);var replaceChar=function(match_str,char_code){return String.fromCharCode(parseInt("0x"+char_code));};line=line.replace(/\\x([\da-fA-F]{2})/g,replaceChar);line=line.replace(/\\u([\da-fA-F]{4})/g,replaceChar);return line;},shouldBlockURI:function(origin,location){var isJS=location.scheme=="javascript";var url=decodeURIComponent(location.spec);var match=isJS?this.jsPattern.exec(url):this.runPattern.exec(url);if(!match)return false;var retobj=new Object();if(isJS){retobj.type="bookmarklet";retobj.data=match[1]=="m"?this.unescapeLine(match[2]):decodeURIComponent(atob(match[2]));}else{retobj.type=match[1];retobj.data=match[2];}if(!origin){retobj.grant=false;retobj.origin="unknown";}if(origin.schemeIs("file")||origin.schemeIs("chrome")){retobj.grant=true;retobj.origin="local";}else{retobj.origin=origin.host;if(!this.querySite(origin.host))retobj.grant=false;else if(this.whiteList[origin.host])retobj.grant=true;else{return true;}}var wm=imns.Cc["@mozilla.org/appshell/window-mediator;1"].getService(imns.Ci.nsIWindowMediator);var win=wm.getMostRecentWindow("navigator:browser");this.osvc.notifyObservers(win,"imacros-runmacro",retobj.toSource());return true;},shouldLoad:function(type,location,origin,ctx,mime,extra){if(type==nsIContentPolicy.TYPE_DOCUMENT){return this.shouldBlockURI(origin,location)?nsIContentPolicy.REJECT_REQUEST:nsIContentPolicy.ACCEPT;}else if(type==nsIContentPolicy.TYPE_OBJECT){if(this.filterImages){if(/^application\/x-shockwave-flash$/.test(mime)||/\.swf$/i.test(location.spec))return nsIContentPolicy.REJECT_REQUEST;}}else if(type==nsIContentPolicy.TYPE_IMAGE){if(this.filterImages){if(/^chrome:\/\//.test(location.spec)||/favicon\.ico$/.test(location.spec))return nsIContentPolicy.ACCEPT;return nsIContentPolicy.REJECT_REQUEST;}}return nsIContentPolicy.ACCEPT;},shouldProcess:function(type,location,origin,ctx,mime,extra){return nsIContentPolicy.ACCEPT;},onChannelRedirect:function(old_channel,new_channel,flags){var origin=old_channel.URI.spec;var url=new_channel.URI.spec;if(this.shouldBlockURI(origin,url)){new_channel.cancel(NS_BINDING_ABORTED);}},get osvc(){var os=Cc["@mozilla.org/observer-service;1"];return os.getService(nsIObserverService);},QueryInterface:function(iid){if(iid.equals(nsISupports)||iid.equals(nsIContentPolicy)||iid.equals(nsIChannelEventSink))return this;throw Components.results.NS_ERROR_NO_INTERFACE;}};const IMPROTO_CLASS_ID=Components.ID("{d32d50cf-ec60-4758-b945-44e208f27120}");const IMPROTO_CLASS_NAME="iMacros Protocol Handler";const IMPROTO_CONTRACT_ID="@mozilla.org/network/protocol;1?name=imacros";function iMacrosProtocol(){this.protocolFlags=Ci.nsIProtocolHandler.URI_NORELATIVE|Ci.nsIProtocolHandler.URI_NOAUTH;if(Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE)this.protocolFlags|=Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE;};iMacrosProtocol.prototype={scheme:"imacros",defaultPort: -1,allowPort:function(port,scheme){return false;},newURI:function(spec,charset,baseURI){var uri=Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI);uri.spec=spec;return uri;},newChannel:function(uri){var ios=Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);return ios.newChannel("javascript:void",null,null);},get osvc(){var os=Cc["@mozilla.org/observer-service;1"];return os.getService(nsIObserverService);},QueryInterface:function(iid){if(!iid.equals(Ci.nsIProtocolHandler)&& !iid.equals(nsISupports))throw Components.results.NS_ERROR_NO_INTERFACE;return this;}};const STORAGE_CLASS_ID=Components.ID("{40048f63-da21-4398-bf21-5bdecac8869f}");const STORAGE_CLASS_NAME="iMacros Temporary Storage";const STORAGE_CONTRACT_ID="@iopus.com/storage;1";function iMacrosStorage(){this.wrappedJSObject=this;this.m_namedObject=new Object();this.m_namedObject["global"]=new Object();};iMacrosStorage.prototype={get namedObject(){return this.m_namedObject;},getNamedObject:function(name){return this.m_namedObject["global"][name];},setNamedObject:function(name,value){this.m_namedObject["global"][name]=value;},clear:function(name){if(name in this.m_namedObject["global"])delete this.m_namedObject["global"][name];},clearAll:function(){for(var x in this.m_namedObject["global"]){this.clear(x);}},getObjectForWindow:function(wid,name){if(!(wid in this.m_namedObject))return null;return this.m_namedObject[wid][name];},setObjectForWindow:function(wid,name,value){if(!(wid in this.m_namedObject))this.m_namedObject[wid]=new Object();this.m_namedObject[wid][name]=value;},clearWindowObject:function(wid,name){if(name in this.m_namedObject[wid])delete this.m_namedObject[wid][name];},QueryInterface:function(iid){if(iid.equals(nsISupports))return this;throw Components.results.NS_ERROR_NO_INTERFACE;}};const PM_CLASS_ID=Components.ID("{38f6b153-a27f-473e-98a9-03541bc9979f}");const PM_CLASS_NAME="iMacros Password Manager";const PM_CONTRACT_ID="@iopus.com/password-manager;1";const iMacros_auth_host="chrome://imacros";const iMacros_auth_desc="iMacros master password";function iMacrosPasswordManager(){this.wrappedJSObject=this;this.sessionPassword=null;};iMacrosPasswordManager.prototype={getMasterPwd:function(){var password=null;if("@mozilla.org/passwordmanager;1"in imns.Cc){password=this.enquire_pm("master");}else if("@mozilla.org/login-manager;1"in imns.Cc){password=this.enquire_lm("master");}if(!password){try{password=this.gprefs.getCharPref("mastersec");password=decodeURIComponent(password);}catch(e){}if(password){this.gprefs.clearUserPref("mastersec");this.setMasterPwd(password);}}return password;},setMasterPwd:function(password){if("@mozilla.org/passwordmanager;1"in imns.Cc){this.store_pm("master",password);}else if("@mozilla.org/login-manager;1"in imns.Cc){this.store_lm("master",password);}},getSessionPwd:function(){return this.sessionPassword;},setSessionPwd:function(password){this.sessionPassword=password;},get encryptionType(){var type=this.TYPE_NONE;try{type=__int(this.gprefs.getCharPref("cursec"));this.gprefs.clearUserPref("cursec");this.encryptionType=type;}catch(e){}try{type=this.prefs.getIntPref("encryptionType");}catch(e){this.prefs.setIntPref("encryptionType",this.TYPE_NONE);}return type;},set encryptionType(typ){var dummy;switch(typ){case this.TYPE_NONE:case this.TYPE_STORED:case this.TYPE_TEMP:this.prefs.setIntPref("encryptionType",typ);break;default:this.prefs.setIntPref("encryptionType",this.TYPE_NONE);}},get TYPE_NONE(){return 1;},get TYPE_STORED(){return 2;},get TYPE_TEMP(){return 3;},get prefs(){var prefsvc=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);return prefsvc.getBranch("extensions.imacros.");},get gprefs(){var prefsvc=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);return prefsvc.getBranch(null);},get pm(){return imns.Cc["@mozilla.org/passwordmanager;1"].getService(imns.Ci.nsIPasswordManager);},get lm(){return imns.Cc["@mozilla.org/login-manager;1"].getService(imns.Ci.nsILoginManager);},enquire_pm:function(user){var e=this.pm.enumerator;while(e.hasMoreElements()){var pass=e.getNext().QueryInterface(imns.Ci.nsIPassword);if(pass.host==iMacros_auth_host&&pass.user==user){return pass.password;}}return null;},enquire_lm:function(user){var logins=this.lm.findLogins({},iMacros_auth_host,iMacros_auth_desc,null);for(var i=0;i<logins.length;i++){if(logins[i].username==user){return logins[i].password;}}return null;},store_pm:function(user,password){this.pm.addUser(iMacros_auth_host,user,password);},store_lm:function(user,password){var nsLoginInfo=new Components.Constructor("@mozilla.org/login-manager/loginInfo;1",imns.Ci.nsILoginInfo,"init");var login=new nsLoginInfo(iMacros_auth_host,iMacros_auth_desc,null,user,password,"","");var logins=this.lm.findLogins({},iMacros_auth_host,iMacros_auth_desc,null);for(var i=0;i<logins.length;i++){if(logins[i].username==user){this.lm.modifyLogin(logins[i],login);return;}}this.lm.addLogin(login);},QueryInterface:function(iid){if(iid.equals(nsISupports))return this;throw Components.results.NS_ERROR_NO_INTERFACE;}};const CLHANDLER_CLASS_ID=Components.ID("{5d5a54d9-729b-40a2-b876-3462a09eb4b8}");const CLHANDLER_CLASS_NAME="iMacros Command line handler";const CLHANDLER_CONTRACT_ID="@iopus.com/cmdlinehandler;1";function CmdlineHandler(){this.wrappedJSObject=this;if(typeof(__loginf)=="undefined")SubLoader.loadSubScript("chrome://imacros/content/utils.js");};CmdlineHandler.prototype={openBrowserWindow:function(arguments){var ww=Components.classes["@mozilla.org/embedcomp/window-watcher;1"].getService(Components.interfaces.nsIWindowWatcher);return ww.openWindow(null,"chrome://browser/content/browser.xul","","dialog=no",arguments);},handle:function(cl){try{var authorizeAll=cl.handleFlagWithParam("authorizeAll",false);var pipeUuid=cl.handleFlagWithParam("pipeUuid",false);var creatorUuid=cl.handleFlagWithParam("creatorUuid",false);if(!authorizeAll|| !pipeUuid|| !creatorUuid)return;if(!/(?:true|false)/i.test(authorizeAll)|| !/[-\w]+/.test(pipeUuid)|| !/[-\w]+/.test(creatorUuid)){Components.utils.reportError("wrong arguments :"+" authorizeAll="+authorizeAll+", pipeUuid="+pipeUuid+", creatorUuid="+creatorUuid);return;}cl.preventDefault=true;var wnd=this.openBrowserWindow(cl.resolveURI("about:blank"));if(wnd){wnd.addEventListener("load",function(e){if(wnd.iOpusOverlay)wnd.iOpusOverlay.init(/true/i.test(authorizeAll),pipeUuid,creatorUuid);},false);}}catch(e){Components.utils.reportError(e);}},helpInfo:"  -authorizeAll <true|false>\n"+"  -pipeUuid <uuid>\n"+"  -creatorUuid <uuid>\n",QueryInterface:function(iid){if(iid.equals(nsISupports)||iid.equals(nsICommandLineHandler))return this;throw Components.results.NS_ERROR_NO_INTERFACE;}};var iMacrosPlayerFactory={createInstance:function(outer,iid){if(outer!=null)throw Components.results.NS_ERROR_NO_AGGREGATION;return(new iMacrosPlayer()).QueryInterface(iid);},QueryInterface:function(iid){if(iid.equals(Ci.nsISupports)||iid.equals(Ci.nsIFactory))return this;throw Components.results.NS_ERROR_NO_INTERFACE;}};var RequestWatcherFactory={createInstance:function(outer,iid){if(outer!=null)throw Components.results.NS_ERROR_NO_AGGREGATION;return(new RequestWatcher()).QueryInterface(iid);},QueryInterface:function(iid){if(iid.equals(Ci.nsISupports)||iid.equals(Ci.nsIFactory))return this;throw Components.results.NS_ERROR_NO_INTERFACE;}};var iMacrosProtocolFactory={createInstance:function(outer,iid){if(outer!=null)throw Components.results.NS_ERROR_NO_AGGREGATION;return(new iMacrosProtocol()).QueryInterface(iid);},QueryInterface:function(iid){if(iid.equals(Ci.nsISupports)||iid.equals(Ci.nsIFactory))return this;throw Components.results.NS_ERROR_NO_INTERFACE;}};var NestedLoopFactory={createInstance:function(outer,iid){if(outer!=null)throw Components.results.NS_ERROR_NO_AGGREGATION;return(new NestedLoop()).QueryInterface(iid);},QueryInterface:function(iid){if(iid.equals(Ci.nsISupports)||iid.equals(Ci.nsIFactory))return this;throw Components.results.NS_ERROR_NO_INTERFACE;}};var iMacrosStorageFactory={createInstance:function(outer,iid){if(outer!=null)throw Components.results.NS_ERROR_NO_AGGREGATION;return(new iMacrosStorage()).QueryInterface(iid);},QueryInterface:function(iid){if(iid.equals(Ci.nsISupports)||iid.equals(Ci.nsIFactory))return this;throw Components.results.NS_ERROR_NO_INTERFACE;}};var iMacrosPasswordManagerFactory={createInstance:function(outer,iid){if(outer!=null)throw Components.results.NS_ERROR_NO_AGGREGATION;return(new iMacrosPasswordManager()).QueryInterface(iid);},QueryInterface:function(iid){if(iid.equals(Ci.nsISupports)||iid.equals(Ci.nsIFactory))return this;throw Components.results.NS_ERROR_NO_INTERFACE;}};var CmdlineHandlerFactory={createInstance:function(outer,iid){if(outer!=null)throw Components.results.NS_ERROR_NO_AGGREGATION;return(new CmdlineHandler()).QueryInterface(iid);},QueryInterface:function(iid){if(iid.equals(Ci.nsISupports)||iid.equals(Ci.nsIFactory))return this;throw Components.results.NS_ERROR_NO_INTERFACE;}};var iMacrosModule={get catmgr(){var mgrc=Cc["@mozilla.org/categorymanager;1"];return mgrc.getService(Ci.nsICategoryManager);},registerSelf:function(compmgr,filespc,loc,typ){var registrar=compmgr.QueryInterface(Ci.nsIComponentRegistrar);registrar.registerFactoryLocation(IFX_CLASS_ID,IFX_CLASS_NAME,IFX_CONTRACT_ID,filespc,loc,typ);registrar.registerFactoryLocation(WATCHER_CLASS_ID,WATCHER_CLASS_NAME,WATCHER_CONTRACT_ID,filespc,loc,typ);this.catmgr.deleteCategoryEntry("content-policy",WATCHER_CONTRACT_ID,true);this.catmgr.addCategoryEntry("content-policy",WATCHER_CONTRACT_ID,WATCHER_CONTRACT_ID,true,true);this.catmgr.deleteCategoryEntry("net-channel-event-sinks",WATCHER_CONTRACT_ID,true);this.catmgr.addCategoryEntry("net-channel-event-sinks",WATCHER_CONTRACT_ID,WATCHER_CONTRACT_ID,true,true);registrar.registerFactoryLocation(IMPROTO_CLASS_ID,IMPROTO_CLASS_NAME,IMPROTO_CONTRACT_ID,filespc,loc,typ);registrar.registerFactoryLocation(LOOP_CLASS_ID,LOOP_CLASS_NAME,LOOP_CONTRACT_ID,filespc,loc,typ);registrar.registerFactoryLocation(STORAGE_CLASS_ID,STORAGE_CLASS_NAME,STORAGE_CONTRACT_ID,filespc,loc,typ);registrar.registerFactoryLocation(PM_CLASS_ID,PM_CLASS_NAME,PM_CONTRACT_ID,filespc,loc,typ);registrar.registerFactoryLocation(CLHANDLER_CLASS_ID,CLHANDLER_CLASS_NAME,CLHANDLER_CONTRACT_ID,filespc,loc,typ);this.catmgr.addCategoryEntry("command-line-handler","m-imacros",CLHANDLER_CONTRACT_ID,true,true);},unregisterSelf:function(compmgr,loc,typ){var registrar=compmgr.QueryInterface(Ci.nsIComponentRegistrar);registrar.unregisterFactoryLocation(IFX_CLASS_ID,loc);registrar.unregisterFactoryLocation(WATCHER_CLASS_ID,loc);this.catmgr.deleteCategoryEntry("content-policy",WATCHER_CONTRACT_ID,true);this.catmgr.deleteCategoryEntry("net-channel-event-sinks",WATCHER_CONTRACT_ID,true);registrar.unregisterFactoryLocation(IMPROTO_CLASS_ID,loc);registrar.unregisterFactoryLocation(LOOP_CLASS_ID,loc);registrar.unregisterFactoryLocation(STORAGE_CLASS_ID,loc);registrar.unregisterFactoryLocation(PM_CLASS_ID,loc);registrar.unregisterFactoryLocation(CLHANDLER_CLASS_ID,loc);this.catmgr.deleteCategoryEntry("command-line-handler","m-imacros",true);},getClassObject:function(compmgr,cid,iid){if(!iid.equals(Ci.nsIFactory))throw Components.results.NS_ERROR_NOT_IMPLEMENTED;if(cid.equals(IFX_CLASS_ID))return iMacrosPlayerFactory;if(cid.equals(WATCHER_CLASS_ID))return RequestWatcherFactory;if(cid.equals(IMPROTO_CLASS_ID))return iMacrosProtocolFactory;if(cid.equals(LOOP_CLASS_ID))return NestedLoopFactory;if(cid.equals(STORAGE_CLASS_ID))return iMacrosStorageFactory;if(cid.equals(PM_CLASS_ID))return iMacrosPasswordManagerFactory;if(cid.equals(CLHANDLER_CLASS_ID))return CmdlineHandlerFactory;throw Components.results.NS_ERROR_NO_INTERFACE;},canUnload:function(compmgr){return true;}};function NSGetModule(compmgr,filespc){return iMacrosModule;}